

<c:if test="${not empty usuarioWeb.usuario }">
	<p><h3 align="center">
		<a href="<c:url value='/carona/nova' />">nova carona</a> | 
		<a href="<c:url value='/carona/oferta' />">oferecer carona</a>
		</h3>
	</p>
</c:if>
<h4>Lista de todas as caronas:</h4> <br />
<table align="center" border="2" cellpadding="5" cellspacing="5">
	<thead>
		<tr>
			<th>Interessado</th>
			<th>email</th>
			<th>Origem</th>
			<th>Destino</th>
			<th>Atraso</th>
		</tr>
	</thead>
	<tbody>
		<c:forEach items="${caronaList}" var="carona">
			<tr>
				<td>${carona.usuario.nome }</td>
				<td>${carona.usuario.email }</td>
				<td>
					${carona.origem.descricao }<br />
					(<fmt:formatNumber type="number" maxFractionDigits="5" minFractionDigits="5" value="${carona.origem.latitude}" />
					|<fmt:formatNumber type="number" maxFractionDigits="5" minFractionDigits="5" value="${carona.origem.longitude}" />
					)
				</td>
				<td>
					${carona.destino.descricao }<br />
					(<fmt:formatNumber type="number" maxFractionDigits="5" minFractionDigits="5" value="${carona.destino.latitude}" />
					|<fmt:formatNumber type="number" maxFractionDigits="5" minFractionDigits="5" value="${carona.destino.longitude}" />
					)
				</td>
				<td>${carona.atraso }min</td> 
				<c:if test="${not empty usuarioWeb.usuario and usuarioWeb.usuario.id == carona.usuario.id }">
					<td><a href="<c:url value="/carona/${ carona.id }"/>">Editar</a></td>		
					<td>
						<form action="<c:url value="/carona/${ carona.id }" />" method="post">
							<button type="submit" name="_method" value="DELETE">Deletar</button>
						</form>
					</td>
				</c:if>
				<c:if test="${empty usuarioWeb.usuario or usuarioWeb.usuario.id != carona.usuario.id }">
					<td>
						<a href="<c:url value='/carona/${carona.id }/detalhe' />" >Ver</a>
					</td>
					
				</c:if>
            </tr>
		</c:forEach>
	</tbody>
</table>